package com.dt.jpa.controller;

import com.dt.jpa.bean.UserInfo;
import com.dt.jpa.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class GetDataController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/hello")
    public String hello(){
        return "hello";
    }

    @PostMapping("/getUser")
    public UserInfo getUser(UserInfo userInfo){
        return userInfoService.getUserInfoById(userInfo.getUserId());
    }
}
